package org.bees.cms.service.bean.furnish;

import java.util.List;

import javax.persistence.EntityManager;

import org.bees.cms.core.furnish.Unit;
import org.bees.cms.service.bean.NamedServiceSupport;
import org.bees.cms.service.bean.ServiceSupport;
import org.bees.cms.service.furnish.UnitService;
import org.springframework.stereotype.Service;

@Service
public class UnitServiceBean extends ServiceSupport<Unit> implements UnitService {
	protected NamedServiceBean namedServiceBean = new NamedServiceBean();

	@Override
	public Unit findByName(String name) throws Exception {
		return namedServiceBean.findByName(name);
	}

	@Override
	public List<Unit> listByName(String name) throws Exception {
		return namedServiceBean.listByName(name);
	}

	protected class NamedServiceBean extends NamedServiceSupport<Unit> {

		@Override
		protected EntityManager manager() {
			return manager;
		}

		@Override
		protected Class<Unit> parameter() {
			return parameter;
		}

	}
}
